package cn.tk.model.entity.mr;

import cn.tk.model.entity.AbstractEntity;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Objects;

/**
 * Created by denglw on 2021/7/16.<br/>
 * Desc: 流程连接线
 */
@Data @NoArgsConstructor
@Entity
@Table(name = "mr_bot_flow_edge")
public class FlowEdge extends AbstractEntity {

    /**
     * botid
     */
    private Long botId;

    /**
     * 流程id
     */
    private Long flowId;

    /**
     * 父节点
     */
    private Long sourceNodeId;

    /**
     * 子节点
     */
    private Long targetNodeId;

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (!(o instanceof FlowEdge)) {
            return false;
        }
        FlowEdge flowEdge = (FlowEdge) o;
        return Objects.equals(flowEdge.getId(), getId())
                && Objects.equals(botId, flowEdge.botId)
                && Objects.equals(flowId, flowEdge.flowId)
                && Objects.equals(sourceNodeId, flowEdge.sourceNodeId)
                && Objects.equals(targetNodeId, flowEdge.targetNodeId);
    }

    @Override
    public int hashCode() {
        return Objects.hash(getId(), botId, flowId, sourceNodeId, targetNodeId);
    }
}
